/**
 * 
 */
package de.cbf.cam.dsa.model.entities;

import java.beans.PropertyChangeSupport;

import javax.persistence.Entity;
import javax.persistence.Id;

import de.cbf.cam.dsa.model.persistence.Header;

/**
 * @author Nebelritter
 *
 */
@Entity
public class OneEnergy extends Header {
	public static final String LE="Lebensenergie";
	public static final String AU="Ausdauer";
	public static final String ASP="Astralenergie";
	public static final String KE="Karmasenergie";
	
	/**
	 * @uml.property  name="name"
	 */
	private String name;
	/**
	 * @uml.property  name="currentValue"
	 */
	private Integer currentValue;
	/**
	 * @uml.property  name="maxValue"
	 */
	private Integer maxValue;
	/**
	 * @uml.property  name="startValue"
	 */
	private Integer startValue;
	/**
	 * @uml.property  name="bought"
	 */
	private Integer bought;
	/**
	 * @uml.property  name="bonus"
	 */
	private Integer bonus;
	
	
	public static String PROPERTYNAME = "OneEnergy:";	
	/**
	 * @uml.property  name="propertyChangeSupport"
	 */
	public PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport(this);
//========================
//		constructors
//========================
	/**
	 * method to initialize object,
	 * provide default values for every field
	 * accessable by all constructors
	 */
	private void init() {
		currentValue	= 0;
		maxValue		= 0;
		startValue		= 0;
		bought			= 0;
		bonus 			= 0;
	}

	public OneEnergy(String name) {
		super();
		init();
		this.name = name;
	}

	
//========================
//		   public methods
//========================

//========================
//	    standard methods
//========================
	@Override
	public String toString() {
		return name+":"+currentValue.toString();
	}

//========================
//	 	   private methods
//========================

//========================
//	 	SHORT property access
//========================

//========================
//			getters
//========================
	/**
	 * @return  the name
	 * @uml.property  name="name"
	 */
	public String getName() {
		return name;
	}
	/**
	 * @param name  the name to set
	 * @uml.property  name="name"
	 */
	protected void setName(String name) {
		this.name = name;
	}	
	
	/**
	 * @return  the currentValue
	 * @uml.property  name="currentValue"
	 */
	public Integer getCurrentValue() {
		return currentValue;
	}

	/**
	 * @return  the maxValue
	 * @uml.property  name="maxValue"
	 */
	public Integer getMaxValue() {
		return maxValue;
	}

	/**
	 * @return  the startValue
	 * @uml.property  name="startValue"
	 */
	public Integer getStartValue() {
		return startValue;
	}

	/**
	 * @return  the bought
	 * @uml.property  name="bought"
	 */
	public Integer getBought() {
		return bought;
	}
	/**
	 * @return  the bonus
	 * @uml.property  name="bonus"
	 */
	public Integer getBonus() {
		return bonus;
	}

//========================
//			setters
//========================

	/**
	 * @param currentValue  the currentValue to set
	 * @uml.property  name="currentValue"
	 */
	public void setCurrentValue(Integer currentValue) {
		this.currentValue = currentValue;
		propertyChangeSupport.firePropertyChange(PROPERTYNAME+"currentValue",null, currentValue);
	}

	/**
	 * @param maxValue  the maxValue to set
	 * @uml.property  name="maxValue"
	 */
	public void setMaxValue(Integer maxValue) {
		this.maxValue = maxValue;
		propertyChangeSupport.firePropertyChange(PROPERTYNAME+"maxValue",null, maxValue);
	}

	/**
	 * @param startValue  the startValue to set
	 * @uml.property  name="startValue"
	 */
	public void setStartValue(Integer startValue) {
		this.startValue = startValue;
		propertyChangeSupport.firePropertyChange(PROPERTYNAME+"startValue",null, startValue);
	}

	/**
	 * @param bought  the bought to set
	 * @uml.property  name="bought"
	 */
	public void setBought(Integer bought) {
		this.bought = bought;
		propertyChangeSupport.firePropertyChange(PROPERTYNAME+"bought",null,bought);
	}
	/**
	 * @param bonus  the bonus to set
	 * @uml.property  name="bonus"
	 */
	public void setBonus(Integer bonus) {
		this.bonus = bonus;
		propertyChangeSupport.firePropertyChange(PROPERTYNAME+"bonus",null, bonus);
	}

	@Override
	@Id
	public String getGuid() {
		return guid;
	}
	@Override
	protected void setGuid(String guid) {
		this.guid = guid;		
	}

	


}
